package com.et114.modules.order.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.et114.core.action.BaseDispatchAction;
import com.et114.core.utility.DateUtil;
import com.et114.modules.cust.services.IMng_CustService;
import com.et114.modules.cust.services.Mng_CustServiceImp;
import com.et114.modules.myet.service.IMyEt_UCenterService;
import com.et114.modules.myet.service.MyEt_UCenterServiceImp;
import com.et114.modules.order.form.OrderForm;
import com.et114.modules.order.service.IMng_OrderService;
import com.et114.modules.order.service.Mng_OrderServiceImp;
import com.et114.modules.order.vo.OrderTrack;
import com.et114.modules.products.supplier.vo.ProSuppliers;

/**
 * 订单信息查询
 * @author zhiweip
 * @version 1.0
 * @created 09-十一月-2010 23:03:48
 */
public class Mng_OrderReportAction  extends BaseDispatchAction {
	 
	private IMng_OrderService mng_OrderService = ( Mng_OrderServiceImp )getBean ( "mng_OrderService" ) ;
	private IMng_CustService mng_CustService	= ( Mng_CustServiceImp ) getBean ( "mng_CustService" );
	private IMyEt_UCenterService	m_IMyEt_UCenterService	= ( MyEt_UCenterServiceImp ) getBean ( "m_IMyEt_UCenterService" );
	private String					COUNTRY_ZH;
	@ Override
	public ActionForward unspecified ( ActionMapping mapping ,
			ActionForm form , HttpServletRequest request ,
			HttpServletResponse response ) throws Exception { 
		OrderForm cform=(OrderForm)form; 
		OrderTrack vo=cform.getOrd ( );
		String today=DateUtil.getTodayString (false );
		today=today.substring ( 0 , today.length ( )-2 )+"01";
		today=DateUtil.getDateOutUSA ( today , false );
		vo.setKey_b ( today );
		request.setAttribute ( "ord" , vo );
		
		return mapping.findForward ( "repview_Emp" );
	}

	public ActionForward viewRep ( ActionMapping mapping ,
			ActionForm form , HttpServletRequest request ,
			HttpServletResponse response ) throws Exception {
		OrderForm cform=(OrderForm)form; 
		
		OrderTrack vo=cform.getOrd ( );
		vo.setPageNum ( cform.getPageNum ( ) );
		vo.setPageSize ( cform.getPageSize ( ) );
		request.setAttribute ( "ord" , vo );
		
		request.setAttribute ( "OPTIONS" , mng_CustService.getItemTypes ( ) ) ;
		request.setAttribute ( "EMPLYS" , ((com.et114.modules.cust.dao.Mng_CustDaoImp)getBean("mng_CustDao")).query_AllEmpList(null));
		request.setAttribute ( "REPDATA" , mng_OrderService.rep_order_Emp ( vo )) ;
		
		return mapping.findForward ( "repview_Emp" );
	}
	
	public ActionForward repOrd ( ActionMapping mapping ,
			ActionForm form , HttpServletRequest request ,
			HttpServletResponse response ) throws Exception { 
		OrderForm cform=(OrderForm)form; 
		OrderTrack vo=cform.getOrd ( );
		String today=DateUtil.getTodayString (false );
		today=today.substring ( 0 , today.length ( )-2 )+"01";
		today=DateUtil.getDateOutUSA ( today , false );
		vo.setKey_b ( today );
		request.setAttribute ( "ord" , vo );
		
		return mapping.findForward ( "repview_Sup" );
	}

	public ActionForward viewRepOrd ( ActionMapping mapping ,
			ActionForm form , HttpServletRequest request ,
			HttpServletResponse response ) throws Exception {
		OrderForm cform=(OrderForm)form; 
		
		OrderTrack vo=cform.getOrd ( );
		vo.setPageNum ( cform.getPageNum ( ) );
		vo.setPageSize ( cform.getPageSize ( ) );
		request.setAttribute ( "ord" , vo );
		ProSuppliers pro=new ProSuppliers();
		pro.setRemoveMark ( "0" );
		request.setAttribute ( "OPTIONS" , mng_CustService.getItemTypes ( ) ) ;
		request.setAttribute ( "SUPLIES" , mng_OrderService.getOrd_ProSuppliers(pro));
		request.setAttribute ( "REPDATA" , mng_OrderService.rep_order_Sup ( vo )) ;
		
		return mapping.findForward ( "repview_Sup" );
	}
	
}